@model OrchardCore.Queries.Sql.ViewModels.SqlQueryViewModel

<script asp-name="codemirror" depends-on="admin" at="Foot"></script>
<script asp-name="codemirror-mode-javascript" at="Foot"></script>
<script asp-name="codemirror-mode-sql" at="Foot"></script>

<div class="form-group">
    <div class="custom-control custom-checkbox">
        <input type="checkbox" class="custom-control-input" asp-for="ReturnDocuments" checked="@Model.ReturnDocuments" />
        <label class="custom-control-label" asp-for="ReturnDocuments">@T["Return Documents"]</label>
        <span class="hint">— @T["Check to return the corresponding documents."]</span>
    </div>
    <span class="hint">@T["When checked, the result has to be a list of document ids."]</span>
</div>

<div class="form-group">
    <label asp-for="Query">@T["Query"]</label>
    <textarea asp-for="Query" rows="12" class="form-control"></textarea>
    <span class="hint">@T["The SQL query to execute."]</span>
</div>

<script at="Foot">
    $(function () {
        CodeMirror.fromTextArea(document.getElementById('@Html.IdFor(x => x.Query)'), { mode: "text/x-pgsql", lineNumbers: true, viewportMargin: Infinity });
    });
</script>
